package com.qk.management.express;

/**
 * 快递状态枚举
 */
public enum ExpressStatus {
    COLLECTED("0", "已揽收"),
    IN_TRANSIT("1", "运输中"),
    DELIVERING("2", "派送中"),
    SIGNED("3", "已签收"),
    DELIVERY_FAILED("4", "派送失败"),
    PROBLEMATIC("5", "疑难件"),
    RETURN_SIGNED("6", "退件签收");
    
    private final String code;
    private final String description;
    
    ExpressStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static ExpressStatus getByCode(String code) {
        for (ExpressStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
    
    public static String getDescriptionByCode(String code) {
        ExpressStatus status = getByCode(code);
        return status != null ? status.getDescription() : "未知状态";
    }
}